export function lineAreaChartFun(data, chartsId) {
  let seriesData = (data.yData || []).map((item, index) => {
    return {
      name: item.name || '',
      type: 'line',
      areaStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: data.color[index][1], // 0% 处的颜色
            },
            {
              offset: 1,
              color: data.color[index][0], // 100% 处的颜色
            },
          ],
          global: false, // 缺省为 false
        }
      },
      symbolSize: 0,
      symbol: 'circle',
      smooth: true,
      //拐点球配置
      itemStyle: {
        normal: {
          color: data.color[index][2],
          margin: [0, 2, 0, 2]
        },
      },
      lineStyle: {
        normal: {
          color: data.color[index][2],
          width: 1,
        },
      },
      data: item.value || [],
    };
  });
  let lineAreaChartsOption = {
    tooltip: {
      trigger: "axis",
    },
    grid: {
      left: data.left ? data.left : '4%',
      right: '0%',
      bottom: '2%',
      top: data.top ? data.top :'14%',
      containLabel: true,
    },
    //图例
    legend: {
      show: data.legendShow === false ? data.legendShow : true,
      left: data.legendLeft ? data.legendLeft : '10%',
      top:'-8',
      textStyle: {
        color: '#C9DFFF',
        fontSize: 10,
        lineHeight: 28,
      },
      itemWidth: 12,
      itemHeight: 8,
      itemGap: 10,
    },
    xAxis: {
      type: 'category',
      data: data.xData,
      axisLine: {
        show: true,
        lineStyle: {
          type: "dotted",
          color: "rgba(139,209,182,0.38)",
          type: [6, 3],
          dashOffset: 2,
        },
      },
      axisTick: {
        show: false,
      },
      axisLabel: {
        show: true,
        textStyle: {
          color: '#C6F0FFFF', //X轴文字颜色
          fontSize: 12
        },
      },
    },
    yAxis: {
      type: "value",
      name: data.name,
      nameTextStyle: {
        color: '#C6F0FFFF', // 字体颜色
        fontSize: 12 // 字体大小
      },
      splitLine: {
        show: true,
        lineStyle: {
          type: "dotted",
          color: "rgba(139,209,182,0.38)",
          type: [6, 3],
          dashOffset: 2,
        },
      },
      axisLabel: {
        padding: [0, 5, 0, 0],
        fontSize: 12,
        textStyle: {
          color: "#C9DFFF",
          fontFamily: "Microsoft YaHei",
        },
      },
    },
    series: seriesData,
  };
  return lineAreaChartsOption
}
